<?php
/**
 * Qin template hooks
 *
 * @package qin
 */

add_action( 'init', 'remove_parent_action' );

add_action( 'wp_enqueue_scripts', 'qin_enqueue_styles', 30 ); // Before WooCommerce.s
add_action( 'wp_enqueue_scripts', 'qin_enqueue_scripts', 40 ); // After WooCommerce.
add_action( 'woocommerce_after_customer_login_form', 'qin_login_form_scripts' );

add_action( 'storefront_header', 'qin_header_my_account', 15 );
// add_action( 'storefront_header', 'storefront_product_search', 55 );

add_action( 'rest_api_init', function () {
  register_rest_route( 'qin/v1', '/products/categories', array(
    'methods' => 'GET',
    'callback' => 'get_product_categories_json',
  ) );
} );

// Master slide before content
add_action( 'storefront_before_content', 'qin_masterslide_before_content', 10 );

// Widget before content
add_action( 'storefront_before_footer', 'qin_content_widget_columns_region', 10 );

// Widget before content
add_action( 'storefront_before_footer', 'qin_after_content_widget_region', 20 );

add_filter( 'storefront_copyright_text', 'qin_copyright');
add_filter( 'storefront_credit_link', 'qin_credit_link');

// Remove review tab in product page
add_filter( 'woocommerce_product_tabs', 'qin_remove_review_tab' );

// Remove header in product tab panels
add_filter( 'woocommerce_product_description_heading', 'qin_remove_tab_heading' );
add_filter( 'woocommerce_product_additional_information_heading', 'qin_remove_tab_heading' );

// rename New In to New Arrivals
add_filter( 'storefront_recent_products_args', 'qin_recent_products_args' );
// wrap the title in span for styling
add_filter( 'storefront_product_categories_args', 'qin_wrap_section_title' );
add_filter( 'storefront_recent_products_args', 'qin_wrap_section_title' );
add_filter( 'storefront_featured_products_args', 'qin_wrap_section_title' );
add_filter( 'storefront_popular_products_args', 'qin_wrap_section_title' );
add_filter( 'storefront_on_sale_products_args', 'qin_wrap_section_title' );
add_filter( 'storefront_best_selling_products_args', 'qin_wrap_section_title' );

add_filter( 'storefront_sidebar_args', 'qin_sidebar_widgets' );
